{extend name="../../admin/view/full"}

{block name='content'}
<div class="iframe-pagination">
    {include file='news/item/select_search'}
    <table class="layui-table" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th>文章标题</th>
            <th>文章状态</th>
            <th>创建时间</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key => $vo}
        <tr>
            <td class="nowrap">{$vo.name|default=''}</td>
            <td>{if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">已激活</span>{/if}</td>
            <td>{$vo.create_at|format_datetime}</td>
            <td class='text-right'><a class="layui-btn layui-btn-sm layui-btn-normal" data-item="{$vo.code}">选择文章</a></td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}

{block name='script'}
<script>
    $(function () {
        $.form.reInit(), layui.form.render();
        $('[data-item]').on('click', function () {
            top.setItemValue(this.getAttribute('data-item') || '');
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        });
    });
</script>
{/block}
